﻿
using System;
using System.IO.IsolatedStorage;
namespace WCYCReader.Main
{
    public class GetNowTime
    {
        public static void DeleteIsostore(string imageUri)
        {
            if (string.IsNullOrWhiteSpace(imageUri))
                return;


            try
            {
                IsolatedStorageFile userStoreForApplication = IsolatedStorageFile.GetUserStoreForApplication();
                string path = "/Shared/ShellContent/" + new Uri(imageUri).AbsolutePath.TrimStart(new char[] { '/' }).Replace('/', '_');
                if (userStoreForApplication.FileExists(path))
                {
                    userStoreForApplication.DeleteFile(path);
                }
            }
            catch { }
        }

        public static string Get()
        {
            return (((DateTime.Now.Hour < 10) ? ((DateTime.Now.Hour == 0) ? "00" : ("0" + DateTime.Now.Hour.ToString())) : DateTime.Now.Hour.ToString()) + ":" + ((DateTime.Now.Minute < 10) ? ((DateTime.Now.Minute == 0) ? "00" : ("0" + DateTime.Now.Minute.ToString())) : DateTime.Now.Minute.ToString()));
        }

        public static bool Isostore(string path)
        {
            return IsolatedStorageFile.GetUserStoreForApplication().FileExists(path);
        }

        public static string SetPercentageText(double percentage)
        {
            double num = Math.Round((double)(percentage * 100.0), 2);
            string str = num.ToString();
            if (num < 10.0)
            {
                if (str.Length == 1)
                {
                    return (str + ".00%");
                }
                if (str.Length == 3)
                {
                    return (str + "0%");
                }
                return (str + "%");
            }
            if (num > 99.99)
            {
                return "100.00%";
            }
            if (str.Length == 2)
            {
                return (str + ".00%");
            }
            if (str.Length == 4)
            {
                return (str + "0%");
            }
            return (str + "%");
        }
    }
}

